//@author A0092201X
/**********************************************************************************************************
Name: TextManipulator
Type: Child Class of Manipulator
Purpose: Responsible for interacting, manipulating and maintaining the text file database - 
		 appending and writing contents into, reading contents from, and sorting contents in.
		 Sort order is - all floating tasks on top, followed by all other tasks sorted by
		 start date/time then end date/time for timed, start date/time for partial-timed, 
		 and deadline date/time for deadline tasks.
Preconditions: Assumes that the task received is correctly furnished with the correct attributes.
Postconditions: Append, write, read and sort APIs perform its desired functions:
				(1) Append - Appends a task line string to the text file and saves it.
				(2) Write - Overwrites contents in the text file and saves it.
				(3) Read - Read contents from the text file and returns a vector of tasks
				(4) Sort - Sort contents in the text file by the above mentioned sort order
**********************************************************************************************************/

#pragma once

#include "Manipulator.h"

class TextManipulator : public Manipulator
{
private:
	static bool compareTime(Task, Task);
	static long assignFirstTimePriority(Task);
	static long assignSecondTimePriority(Task);

public:
	TextManipulator(std::string fileName);
	~TextManipulator(void);

	void write(std::vector<Task>);
	void append(Task);
	std::vector<Task> read(void);
	void sort();
};

